home *** CD-ROM | disk | FTP | other *** search
/ ip-72-10-208-29.nwptny.ntcnet.net / ip-72-10-208-29.nwptny.ntcnet.net.tar / ip-72-10-208-29.nwptny.ntcnet.net / newhartsystems / ASP / Copy (2) of Eval.aspx.cs < prev    next >
Text File  |  2007-11-28  |  11KB  |  318 lines

  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Web;
  7. using System.Web.SessionState;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.HtmlControls;
  11. using System.Configuration;
  12.  
  13. using Quiksoft.EasyMail.SMTP;
  14.  
  15.  
  16. namespace Order
  17. {
  18.     /// <summary>
  19.     /// Summary description for Eval.
  20.     /// </summary>
  21.     public class Eval : System.Web.UI.Page
  22.     {
  23.         protected System.Web.UI.WebControls.Label Label1;
  24.         protected System.Web.UI.WebControls.Label Label3;
  25.         protected System.Web.UI.WebControls.Label Label4;
  26.         protected System.Web.UI.WebControls.TextBox EmailAddress;
  27.         protected System.Web.UI.WebControls.Label Label5;
  28.         protected System.Web.UI.WebControls.Label Label6;
  29.         protected System.Web.UI.WebControls.TextBox Name;
  30.         protected System.Web.UI.WebControls.Label Label7;
  31.         protected System.Web.UI.WebControls.TextBox PhoneNumber;
  32.         protected System.Web.UI.WebControls.Label Label8;
  33.         protected System.Web.UI.WebControls.Label Label2;
  34.         protected System.Web.UI.WebControls.Button Submit;
  35.         protected System.Web.UI.WebControls.DropDownList Item;
  36.     
  37.  
  38.         /// <summary>
  39.         /// Email account for sending emails
  40.         /// </summary>
  41.         static internal protected string SmtpAddress = ConfigurationSettings.AppSettings["SmtpServer"];    //mail.dc1.adelphia.net
  42.         static internal protected string SupportUrl = ConfigurationSettings.AppSettings["SupportUrl"];
  43.         protected System.Web.UI.WebControls.Label Label11;
  44.         protected System.Web.UI.WebControls.ImageButton ImageButton1;
  45.         protected System.Web.UI.WebControls.ImageButton ImageButton2;
  46.         protected System.Web.UI.WebControls.ImageButton ImageButton3;
  47.         protected System.Web.UI.WebControls.ImageButton ImageButton4;
  48.         protected System.Web.UI.WebControls.ImageButton ImageButton5;
  49.         protected System.Web.UI.WebControls.ImageButton ImageButton6;
  50.         protected System.Web.UI.WebControls.ImageButton ImageButton7;
  51.         protected System.Web.UI.WebControls.ImageButton ImageButton8;
  52.         protected System.Web.UI.WebControls.ImageButton ImageButton10;
  53.         protected System.Web.UI.WebControls.Label Label12;
  54.         protected System.Web.UI.WebControls.Label Description;    //mail.dc1.adelphia.net
  55.  
  56.         static internal protected string DownloadNotificationTo = ConfigurationSettings.AppSettings["DownloadEmailTo"];        
  57.  
  58.         private void Page_Load(object sender, System.EventArgs e)
  59.         {
  60.             // Put user code to initialize the page here
  61.         }
  62.  
  63.         #region Web Form Designer generated code
  64.         override protected void OnInit(EventArgs e)
  65.         {
  66.             //
  67.             // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  68.             //
  69.             InitializeComponent();
  70.             base.OnInit(e);
  71.         }
  72.         
  73.         /// <summary>
  74.         /// Required method for Designer support - do not modify
  75.         /// the contents of this method with the code editor.
  76.         /// </summary>
  77.         private void InitializeComponent()
  78.         {    
  79.             this.ImageButton10.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton10_Click);
  80.             this.ImageButton8.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton8_Click);
  81.             this.ImageButton6.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton6_Click);
  82.             this.ImageButton5.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton5_Click);
  83.             this.ImageButton4.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton4_Click);
  84.             this.ImageButton2.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton2_Click);
  85.             this.Item.SelectedIndexChanged += new System.EventHandler(this.Item_SelectedIndexChanged);
  86.             this.Submit.Click += new System.EventHandler(this.Submit_Click);
  87.             this.Load += new System.EventHandler(this.Page_Load);
  88.  
  89.         }
  90.         #endregion
  91.  
  92.         private void Item_SelectedIndexChanged(object sender, System.EventArgs e)
  93.         {
  94.             if(String.Compare(this.Item.SelectedValue,"Blues2003Client",true)==0)
  95.                 Description.Text = "Blues 2003 .NET Windows Software";
  96.             else
  97.             if(String.Compare(this.Item.SelectedValue,"Blues2003Developer",true)==0)
  98.                 Description.Text = "Blues 2003 .NET Windows Software";
  99.             else
  100.             if(String.Compare(this.Item.SelectedValue,"BluesMobile04",true)==0)
  101.                 Description.Text = "Blues Mobile 04 Software";
  102.             else
  103.             if(String.Compare(this.Item.SelectedValue,"BluesVirtualHost",true)==0)
  104.                 Description.Text = "Blues Virtual Host Software";
  105.             else
  106.                 Description.Text = "Blues 2000 32 bit Windows Software";
  107.         
  108.         }
  109.  
  110.         static internal protected string EmailOrderFrom = ConfigurationSettings.AppSettings["EmailOrderFrom"];
  111.  
  112. /// <summary>
  113. /// Send the person an email message with instructions on downloading the trial copy
  114. /// </summary>
  115. /// <param name="sender"></param>
  116. /// <param name="e"></param>
  117.         private void Submit_Click(object sender, System.EventArgs e)
  118.         {
  119.         
  120.             if(this.EmailAddress.Text.Length == 0)
  121.             {
  122.                 this.MessageBoxOk("Please enter your email address !");
  123.                 return;            
  124.             }
  125.  
  126.             if(this.Name.Text.Length == 0)
  127.             {
  128.                 this.MessageBoxOk("Please enter your name !");
  129.                 return;            
  130.             }
  131.  
  132.             if(this.PhoneNumber.Text.Length == 0)
  133.             {
  134.                 this.MessageBoxOk("Please enter your phone number !");
  135.                 return;            
  136.             }
  137.  
  138.             //
  139.             //email myself the download record to import into Goldmine
  140.             //
  141.             string Body = "";
  142.  
  143.             Body += "\"" + this.Name.Text + "\"" + ",";
  144.             Body += "\"" + "" + "\"" + ",";
  145.             Body += "\"" + "" + "\"" + ",";
  146.             Body += "\"" + "" + "\"" + ",";
  147.             Body += "\"" + "" + "\"" + ",";
  148.             Body += "\"" + "" + "\"" + ",";
  149.             Body += "\"" + "" + "\"" + ",";
  150.             Body += "\"" + "" + "\"" + ",";
  151.             Body += "\"" + "" + "\"" + ",";
  152.             Body += "\"" + this.PhoneNumber.Text + "\"" + ",";
  153.             Body += "\"" + "" + "\"" + ",";
  154.             Body += "\"" + this.EmailAddress.Text + "\"" + ",";
  155.             Body += "\"" + "" + "\"" + ",";
  156.             Body += "\"" + "" + "\"" + ",";
  157.             Body += "\"" + this.Item.SelectedValue + "\"" + "\"";
  158.             this.SendEmail(DownloadNotificationTo,DownloadNotificationTo,"DOWNLOADED TRIAL",Body,null);
  159.  
  160.             //
  161.             //email the user instructions on downloading the product
  162.             //
  163.             string Product;
  164.             string DownloadUrl;
  165.             string PricingUrl = ConfigurationSettings.AppSettings["PricingHttp"];
  166.  
  167.  
  168.             if(String.Compare(this.Item.SelectedValue,"Blues2000",true)==0)
  169.             {
  170.                 Product = "Blues 2000";
  171.                 DownloadUrl = ConfigurationSettings.AppSettings["Blues2000Trial"];
  172.             }
  173.             else
  174.             if(String.Compare(this.Item.SelectedValue,"Blues2003Developer",true)==0)
  175.             {
  176.                 Product = "Blues 2003";
  177.                 DownloadUrl = ConfigurationSettings.AppSettings["Blues2003DevTrial"];
  178.             }
  179.             else
  180.             if(String.Compare(this.Item.SelectedValue,"BluesMobile04",true)==0)
  181.             {
  182.                 Product = "Blues Mobile 04";
  183.                 DownloadUrl = ConfigurationSettings.AppSettings["BluesMobileDevTrial"];
  184.             }
  185.             else
  186.             if(String.Compare(this.Item.SelectedValue,"BluesVirtualHost",true)==0)
  187.             {
  188.                 Product = "Blues Virtual Host";
  189.                 DownloadUrl = ConfigurationSettings.AppSettings["BluesVirtualHostTrial"];
  190.             }
  191.             else
  192.             {
  193.                 Product = "Blues 2003";
  194.                 DownloadUrl = ConfigurationSettings.AppSettings["Blues2003CliTrial"];
  195.             }
  196.                 
  197.             Body = String.Format("Thank you for trying our {0} product.\r\n\r\nTo download your trial copy, please go to the following address:\r\n\r\n{1}\r\n\r\nIf you need help with the product, please go to the following address:\r\n\r\n{2}\r\n\r\nIf you need pricing, please go to the following address.  Our prices are on our order form:\r\n\r\n{3}\r\n\r\nThank You,\r\n\r\n\r\nNewhart Systems Inc.\r\nwww.newhartsystems.com\r\n315-896-4131\r\n",Product,DownloadUrl,SupportUrl,PricingUrl);
  198.             
  199.             
  200.             this.SendEmail(EmailOrderFrom,this.EmailAddress.Text,String.Format("{0} Download Instructions",Product),Body,null);
  201.  
  202.             this.MessageBoxOk(String.Format("Thank you, please check your email for instructions on downloading our product."));
  203.  
  204.  
  205.         }
  206.  
  207.  
  208.         internal bool SendEmail(string From,string To,string Subject,string Body,string AttachedFile)
  209.         {
  210.             bool SendFailed = false;
  211.             Quiksoft.EasyMail.SMTP.SMTP sm = new SMTP();
  212.             Quiksoft.EasyMail.SMTP.EmailMessage ml = new EmailMessage();
  213.             
  214.             
  215.             try
  216.             {
  217.                 Quiksoft.EasyMail.SMTP.License.Key = "newhartsystems (Single Developer)/8128517F39914787F411A81610D9A";
  218.  
  219.                 ml.From.Email = From;
  220.                 ml.Recipients.Add(To);
  221.                 ml.Subject = Subject;
  222.                 ml.BodyParts.Add(Body);
  223.                 sm.SMTPServers.Add(SmtpAddress);
  224.  
  225.                 if(AttachedFile != null)
  226.                     ml.Attachments.Add(AttachedFile);
  227.  
  228.  
  229.                 //                ml.Attachments.Add(this.Package);
  230.  
  231.  
  232.                 //                sm.LogFile = "c:\\SMTPLOG";
  233.                 sm.Send(ml);
  234.                 
  235.                 SendFailed = false;
  236.             }
  237.             catch(Exception X)
  238.             {
  239.                 string Err = String.Format("We have encountered an error trying to process your order : {0}, please call us at 315 896 4131 between 8AM and 5PM EST",X.Message);
  240.                 this.MessageBoxOk(Err);
  241.  
  242.                 
  243.                 if(SendFailed)
  244.                 {
  245.                     try
  246.                     {
  247.                         //
  248.                         // Create a log file
  249.                         //
  250.                         //                        File.Delete("c:\\SMTPLOG",false);
  251.                         //                        sm.LogFile = "c:\\SMTPLOG";
  252.                         //                        sm.Send(ml);
  253.                     }
  254.                     catch
  255.                     {
  256.                     }
  257.  
  258.                 }
  259.                 //                MessageBox.Show(String.Format(GetLangMessage("STR_EMAIL_FAILED"),X.Message),"Blues");
  260.                 //                MessageBox.Show(GetLangMessage("STR_NOUSER_IN_DB"),"Blues");
  261.             }
  262.             if(SendFailed)
  263.                 return(false);
  264.             else
  265.                 return(true);
  266.  
  267.         }
  268.  
  269.  
  270.  
  271.         internal void MessageBoxOk(string Msg)
  272.         {
  273.             
  274.             Response.Write("<script type='text/javascript'>alert('" + Msg +"');</script>");            
  275.             return;
  276.  
  277.         }
  278.  
  279.         private void ImageButton5_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  280.         {
  281.             this.Response.Redirect(ConfigurationSettings.AppSettings["HomeUrl"]);
  282.         
  283.         }
  284.  
  285.         private void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  286.         {
  287.             this.Response.Redirect(ConfigurationSettings.AppSettings["ProductsUrl"]);
  288.         
  289.         }
  290.  
  291.         private void ImageButton4_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  292.         {
  293.             this.Response.Redirect(ConfigurationSettings.AppSettings["PricingUrl"]);
  294.         
  295.         }
  296.  
  297.         private void ImageButton6_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  298.         {
  299.             this.Response.Redirect(ConfigurationSettings.AppSettings["OrderUrl"]);
  300.  
  301.         }
  302.  
  303.         private void ImageButton8_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  304.         {
  305.             this.Response.Redirect(ConfigurationSettings.AppSettings["SupportUrl"]);
  306.         
  307.         }
  308.  
  309.         private void ImageButton10_Click(object sender, System.Web.UI.ImageClickEventArgs e)
  310.         {
  311.             this.Response.Redirect(ConfigurationSettings.AppSettings["ContactUrl"]);
  312.  
  313.         }
  314.  
  315.  
  316.     }
  317. }
  318.